/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



package sonia.golf.view;

//~--- non-JDK imports --------------------------------------------------------

import android.app.Activity;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import sonia.golf.R;
import sonia.golf.dao.CourseDAO;
import sonia.golf.dao.DAOFactory;

//~--- JDK imports ------------------------------------------------------------

import java.util.List;

/**
 *
 * @author Sebastian Sdorra
 */
public class CoursesView extends AbstractGolfView
{

  /**
   * Constructs ...
   *
   *
   * @param activity
   */
  public CoursesView(Activity activity)
  {
    super(activity);
    this.courseDAO = DAOFactory.getInstance().getCourseDAO();
  }

  //~--- methods --------------------------------------------------------------

  /**
   * Method description
   *
   */
  public void show()
  {
    ListView couseListView = (ListView) activity.findViewById(R.id.course_list);
    List<String> courseNames = null;//courseDAO.getAllNames();
    ArrayAdapter<String> courseListAdapter = new ArrayAdapter<String>(activity,
                                               R.layout.listitem, courseNames);

    couseListView.setAdapter(courseListAdapter);
  }

  //~--- get methods ----------------------------------------------------------

  /**
   * Method description
   *
   *
   * @return
   */
  public int getLayoutId()
  {
    return R.layout.courseview;
  }

  //~--- fields ---------------------------------------------------------------

  /** Field description */
  private CourseDAO courseDAO;
}
